< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03030205.xhp

(section: timeserial) (bookmark: bm_id3143271)
TimeSerial function

TimeSerial 関数

TimeSerial Function [Runtime]
TimeSerial 関数 [実行時](hd_id3143271.1)

Calculates a serial time value for the specified hour, minute, and second parameters that are passed as numeric value. You can then use this value to calculate the difference between times.
数値として渡される時、分、秒の指定値を基に、該当する時刻データのシリアル換算値を計算します。こうして変換される数値を用いると、異なる時刻間の経過時間などが計算できます。(par_id3156344.2)

(/section: timeserial)

Syntax:
構文:(hd_id3146794.4)

TimeSerial (hour, minute, second)
TimeSerial (hour, minute, second)(par_id3150792.5)

Return value:
戻り値:(hd_id3148797.6)

Date
日付(par_id3154908.7)

Parameters:
パラメータ:(hd_id3154124.8)

hour: Any integer expression that indicates the hour of the time that is used to determine the serial time value. Valid values: 0-23.
hour: シリアル値に換算する時刻データで、時を示す整数表式。これには下記の値を指定できます。 0-23.(par_id3153193.9)

minute: Any integer expression that indicates the minute of the time that is used to determine the serial time value. In general, use values between 0 and 59. However, you can also use values that lie outside of this range, where the number of minutes influence the hour value.
minute: シリアル値に換算する時刻データで、分を示す整数表式。通常使用するのは 0 から 59 までの値です。この範囲外の値も指定できますが、その場合は時の値に影響が生じます。(par_id3159252.10)

second: Any integer expression that indicates the second of the time that is used to determine the serial time value. In general, you can use values between 0 and 59. However, you can also use values that lie outside of this range, where the number seconds influences the minute value.
second: シリアル値に換算する時刻データで、秒を示す整数表式。通常使用するのは 0 から 59 までの値です。この範囲外の値も指定できますが、その場合は分の値に影響が生じます。(par_id3161831.11)

Examples:
例:(par_id3155854.12)

12, -5, 45 corresponds to 11, 55, 45
12, -5, 45 は 11, 55, 45 と見なされます。(par_id3153952.13)

12, 61, 45 corresponds to 13, 2, 45
12, 61, 45 は 13, 2, 45 と見なされます。(par_id3147349.14)

12, 20, -2 corresponds to 12, 19, 58
12, 20, -2 は 12, 19, 58 と見なされます。(par_id3147426.15)

12, 20, 63 corresponds to 12, 21, 4
12, 20, 63 は 12, 21, 4 と見なされます。(par_id3153365.16)

You can use the TimeSerial function to convert any time into a single value that you can use to calculate time differences.
時刻データを TimeSerial 関数で変換して得られる数値は、時刻間の時間計算などに利用できます。(par_id3146985.17)

The TimeSerial function returns the type Variant with VarType 7 (Date). This value is stored internally as a double-precision number between 0 and 0.9999999999. As opposed to the DateSerial or DateValue function, where the serial date values are calculated as days relative to a fixed date, you can calculate with values returned by the TimeSerial function, but you cannot evaluate them.
TimeSerial 関数の返す値は、バリアント型の VarType 7 (Date) です。この値は、内部的には0から 0.9999999999 の倍精度値として格納されます。DateSerial や DateValue 関数では、日付データをシリアル値に変換する際に、固定設定された基準日からの経過日数として換算していますが、TimeSerial 関数で返される値は、時刻間の計算には使えるものの、そのまま直接的な評価が行えるものではありません。(par_id3155308.18)

In the TimeValue function, you can pass a string as a parameter containing the time. For the TimeSerial function, however, you can pass the individual parameters (hour, minute, second) as separate numeric expressions.
TimeValue 関数の場合、時刻データを 1 つの文字列の形で渡します。これに対して TimeSerial 関数では、関数に渡すパラメータ (時、分、秒) は、それぞれ個別の数値表式として指定します。(par_id3149482.19)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3154790.20)

Sub ExampleTimeSerial
Sub ExampleTimeSerial(par_id3145252.21)

Dim dDate As Double, sDate As String
Dim dDate As Double, sDate As String(par_id3153157.22)

dDate = TimeSerial(8,30,15)
dDate = TimeSerial(8,30,15)(par_id3156286.23)

sDate = TimeSerial(8,30,15)
sDate = TimeSerial(8,30,15)(par_id3148456.24)

MsgBox dDate,64,"Time as a number"
MsgBox dDate,64,"Time as a number"(par_id3155600.25)

MsgBox sDate,64,"Formatted time"
MsgBox sDate,64,"Formatted time"(par_id3153417.26)

End Sub
End Sub(par_id3153836.27)


< Prev / Next >